package com.d3works.apps.projectdms.web;

import com.d3works.apps.projectdms.service.DMSFileService;
import com.d3works.dms.db.DMSFile;
import com.d3works.dms.db.repo.DMSFileRepository;
import com.d3works.exception.service.TraceBackService;
import com.d3works.inject.Beans;
import com.d3works.rpc.ActionRequest;
import com.d3works.rpc.ActionResponse;

public class DMSController {

  public void sendEmail(ActionRequest request, ActionResponse response) {
    try {
      DMSFile dmsFile = request.getContext().asType(DMSFile.class);
      dmsFile = Beans.get(DMSFileRepository.class).find(dmsFile.getId());

      Beans.get(DMSFileService.class).sendEmail(dmsFile);
    } catch (Exception e) {
      TraceBackService.trace(response, e);
    }
  }
}
